﻿/*-------------------------------------
//
//Copyright (C) 2007 开发二组 版权所有。
//
//文件名：CustomerService.cs
//
//文件功能描述：顾客管理的外观
// 
//创建标识：2007.11.16 殷悦
//创建描述：
// 
//修改标识：2007.11.18 殷悦
//修改描述：根据业务逻辑层修改部分方法
//------------------------------------*/
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using JXMSTC.SmartBusiness.BFL.BLLFactory;
using JXMSTC.SmartBusiness.BFL.IBLL;

/// <summary>
/// CustomerService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class CustomerService : System.Web.Services.WebService
{
    private readonly ICustomer bll = BLLAccess.CreateCustomer();
    public CustomerService()
    {

        //如果使用设计的组件，请取消注释以下行 
        //InitializeComponent(); 
    }

    /// <summary>
    /// 顾客登录
    /// </summary>
    /// <param name="strCustomerAccount">顾客登录帐号</param>
    /// <param name="strPassword">登录密码</param>
    /// <returns>若登录成功，则返回True,若登录失败，则返回False</returns>
    [WebMethod(Description = "顾客登录")]
    public bool CustomerLogin(string strCustomerAccount, byte[] strPassword)
    {
        return bll.CustomerLogin(strCustomerAccount, strPassword);
    }


    /// <summary>
    /// 判断顾客的注册登录名是否存在
    /// </summary>
    /// <param name="strCustomerAccount">登录名</param>
    /// <returns>若添加成功，则返回True,若添加失败，则返回False</returns>
    [WebMethod(Description="判断顾客的注册登录名是否存在")]
    public bool CustomerAccountIsExist(string strCustomerAccount)
    {
        return bll.CustomerAccountIsExist(strCustomerAccount);
    }


    /// <summary>
    /// 顾客注册
    /// </summary>
    ///<param name="customer">Customer实例,Customer类型</param>
    /// <returns>若添加成功，则返回True,若添加失败，则返回False</returns>
    [WebMethod(Description="顾客注册")]
    public bool CustomerRegister(JXMSTC.SmartBusiness.Common.Model.Customer customer)
    {
        return bll.CustomerRegister(customer);
    }

    /// <summary>
    /// 根据顾客ID获取顾客的历史订单总记录
    /// </summary>
    /// <param name="strCustomerID">顾客ID</param>
    /// <returns>历史订单总记录</returns>
    [WebMethod(Description="根据顾客ID获取顾客的历史订单总记录")]
    public System.Data.DataSet GetOrders(string strCustomerID)
    {
        return bll.GetOrders(strCustomerID);
    }

    /// <summary>
    ///  根据订单ID获取订单的购物人和收货人等信息
    /// </summary>
    /// <param name="orderInfoID">订单ID</param>
    /// <returns>返回该订单详细信息（收货人和购买人等）</returns>
    [WebMethod(Description="根据订单ID获取订单的购物人和收货人等信息")]
    public JXMSTC.SmartBusiness.Common.Model.OrderInfo GetOrderInfo(string orderInfoID)
    {
        return bll.GetOrderInfo(orderInfoID);
    }

    /// <summary>
    /// 根据顾客ID获取顾客的详细信息
    /// </summary>
    /// <param name="strCustomerID">顾客ID</param>
    /// <returns>返回顾客详细信息</returns>
    [WebMethod(Description = "根据顾客ID获取顾客的详细信息")]
    public JXMSTC.SmartBusiness.Common.Model.Customer GetCustomerDetailInfo(string strCustomerID)
    {
        return bll.GetCustomerDetailInfo(strCustomerID);
    }

    /// <summary>
    /// 根据顾客登录名获取顾客ID
    /// </summary>
    /// <param name="strCustomerAccount">顾客登录名</param>
    /// <returns>顾客ID</returns>
    [WebMethod(Description="根据顾客登录名获取顾客ID")]
    public string SelectCustomerID(string strCustomerAccount)
    {
        return bll.SelectCustomerID(strCustomerAccount);
    }

    /// <summary>
    /// 修改顾客登录密码
    /// </summary>
    /// <param name="strCustomerID">顾客登录ID</param>
    /// <param name="bytOldPassword">原密码</param>
    /// <param name="bytNewPassword">新密码</param>
    /// <returns>若修改成功，则返回True,若修改失败，则返回False</returns>   
    [WebMethod(Description="修改顾客登录密码")]
    public bool UpdatePWD(string strCustomerID, byte[] bytOldPassword, byte[] bytNewPassword)
    {
        return bll.UpdatePWD(strCustomerID, bytOldPassword, bytNewPassword);
    }

    /// <summary>
    /// 根据顾客的ID，对顾客名字，顾客性别，顾客邮件，顾客地址等信息进行修改
    /// </summary>
    /// <param name="customer">顾客信息</param>
    /// <returns>修改成功返回true，失败返回false</returns>
    [WebMethod(Description="根据顾客的ID，对顾客名字，顾客性别，顾客邮件，顾客地址等信息进行修改")]
    public bool UpdateCustomerInfo(JXMSTC.SmartBusiness.Common.Model.Customer customer)
    {
        return bll.UpdateCustomerInfo(customer);
    }

    //2007.11.28 翟丛兴添加
    /// <summary>
    /// 发送订单号到顾客的邮箱中
    /// </summary>
    /// <param name="strToEmail">顾客Email</param>
    /// <param name="strOrderInfoID">订单号</param>
    /// <param name="date">下订单的日期</param>
    /// <returns>发送邮件成功返回true,失败返回false</returns>
    [WebMethod(Description="发送订单号到顾客的邮箱中")]
    public bool SendEmail(string strToEmail, string strOrderInfoID, DateTime date)
    {
        return bll.SendEmail(strToEmail, strOrderInfoID, date);
    }

}

